<?php
use think\migration\Migrator;
use think\migration\db\Column;

class CreateMarketingVideoTasks extends Migrator
{
    public function change()
    {
        $this->table('marketing_video_tasks', ['engine' => 'InnoDB'])
            ->addColumn('task_id', 'string', ['limit' => 64, 'comment' => '远程任务ID'])
            ->addColumn('avatar_id', 'string', ['limit' => 64, 'null' => true, 'comment' => '头像ID'])
            ->addColumn('product_image_file_id', 'string', ['limit' => 64, 'comment' => '产品图片文件ID'])
            ->addColumn('template_image_file_id', 'string', ['limit' => 64, 'null' => true, 'comment' => '模板图片文件ID'])
            ->addColumn('user_face_image_file_id', 'string', ['limit' => 64, 'null' => true, 'comment' => '用户人脸图片文件ID'])
            ->addColumn('image_edit_prompt', 'text', ['comment' => '图片编辑提示'])
            ->addColumn('status', 'integer', ['limit' => 1, 'default' => 0, 'comment' => '状态：0待处理,1处理中,2已完成,3失败'])
            ->addColumn('result_images', 'text', ['null' => true, 'comment' => '结果图片JSON数组'])
            ->addColumn('error_msg', 'string', ['limit' => 255, 'null' => true, 'comment' => '错误信息'])
            ->addColumn('user_id', 'integer', ['comment' => '创建者用户ID'])
            ->addColumn('create_time', 'timestamp', ['default' => 'CURRENT_TIMESTAMP'])
            ->addIndex(['task_id'], ['unique' => true])
            ->create();
    }
} 